package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ParkingLotMapper;
import com.ruoyi.system.domain.ParkingLot;
import com.ruoyi.system.service.IParkingLotService;
import com.ruoyi.common.core.text.Convert;

/**
 * 停车场Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-17
 */
@Service
public class ParkingLotServiceImpl implements IParkingLotService
{
    @Autowired
    private ParkingLotMapper parkingLotMapper;

    /**
     * 查询停车场
     *
     * @param id 停车场主键
     * @return 停车场
     */
    @Override
    public ParkingLot selectParkingLotById(Long id)
    {
        return parkingLotMapper.selectParkingLotById(id);
    }

    /**
     * 查询停车场列表
     *
     * @param parkingLot 停车场
     * @return 停车场
     */
    @Override
    public List<ParkingLot> selectParkingLotList(ParkingLot parkingLot)
    {
        return parkingLotMapper.selectParkingLotList(parkingLot);
    }

    /**
     * 新增停车场
     *
     * @param parkingLot 停车场
     * @return 结果
     */
    @Override
    public int insertParkingLot(ParkingLot parkingLot)
    {
        return parkingLotMapper.insertParkingLot(parkingLot);
    }

    /**
     * 修改停车场
     *
     * @param parkingLot 停车场
     * @return 结果
     */
    @Override
    public int updateParkingLot(ParkingLot parkingLot)
    {
        parkingLot.setUpdateTime(DateUtils.getNowDate());
        return parkingLotMapper.updateParkingLot(parkingLot);
    }

    /**
     * 批量删除停车场
     *
     * @param ids 需要删除的停车场主键
     * @return 结果
     */
    @Override
    public int deleteParkingLotByIds(String ids)
    {
        return parkingLotMapper.deleteParkingLotByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除停车场信息
     *
     * @param id 停车场主键
     * @return 结果
     */
    @Override
    public int deleteParkingLotById(Long id)
    {
        return parkingLotMapper.deleteParkingLotById(id);
    }

    @Override
    public ParkingLot selectParkingLotByAddTime(Date date) {
        return parkingLotMapper.selectParkingLotByAddTime(date);
    }

    @Override
    public List<ParkingLot> getParkingLotByAddTime() {
        return parkingLotMapper.getParkingLotByAddTime();
    }
}
